/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2023. All rights reserved.
 */

package errcode

var E struct {
	Base struct {
		Authorization    Status
		Forbidden        Status
		RequestInvalid   Status
		ResourceNotFound Status
		ErrorMessage     Status
	}
	Format struct {
		ContentType Status
	}
	Internal struct {
		Internal           Status
		FileSaveFailed     Status
		FileDownloadFailed Status
	}
	Certification struct {
		InsufficientPermission Status
		HavaNotLogin           Status
	}
}

func init() {
	initErrorCode()
}

func initErrorCode() {
	// 输入参数错误，返回前端错误提示信息
	E.Base.RequestInvalid = Status{
		Code: 400, ErrorCode: "COC.01400001", ErrorMessage: "Invalid request."}
	E.Base.ErrorMessage = Status{
		Code: 400, ErrorCode: "COC.01400002", ErrorMessage: "Input invalid."}
	E.Certification.HavaNotLogin = Status{
		Code: 401, ErrorCode: "COC.01401001", ErrorMessage: "have not log in"}
	E.Certification.InsufficientPermission = Status{
		Code: 403, ErrorCode: "COC.01401002", ErrorMessage: "insufficient permission to access the resource"}
	E.Base.Forbidden = Status{
		Code: 403, ErrorCode: "COC.01403001", ErrorMessage: "Forbidden."}
	E.Base.ResourceNotFound = Status{
		Code: 404, ErrorCode: "COC.01404001", ErrorMessage: "Resource not found."}
	E.Internal.Internal = Status{
		Code: 500, ErrorCode: "COC.01500001", ErrorMessage: "Internal error"}
	E.Internal.FileSaveFailed = Status{
		Code: 500, ErrorCode: "COC.01500002", ErrorMessage: "save file failed."}
	E.Internal.FileDownloadFailed = Status{
		Code: 500, ErrorCode: "COC.01500003", ErrorMessage: "download file failed."}
}
